package com.nyist.zk.service.impl;

import com.nyist.zk.dao.AdminDao;
import com.nyist.zk.entities.Admin;
import com.nyist.zk.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.beans.Transient;
import java.util.List;

@Service
public class AdminServiceImpl implements AdminService {

    @Autowired
    private AdminDao adminDao;

    @Override
    public boolean getAdminByIdAndPassword(Integer a_id, String a_password) {
        Admin admin = adminDao.getAdminByIdAndPassword(a_id,a_password);
        if (admin != null) {
            return true;
        }
        return false;
    }

    @Override
    public List<Admin> findAllAdmin() {
        return adminDao.findAllAdmin();
    }

    @Override
    public Admin findByIdAdmin(Integer a_id) {
        return adminDao.findByIdAdmin(a_id);
    }

    @Override
    @Transient
    public void insertAdmin(Admin admin) {
        adminDao.insertAdmin(admin);
    }

    @Override
    @Transient
    public void deleteByIdAdmin(Integer a_id) {
        adminDao.deleteByIdAdmin(a_id);
    }

    @Override
    @Transient
    public void updateAdmin(Admin admin) {
        adminDao.updateAdmin(admin);
    }

}
